-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Data] Add fillna and dropna functions #54844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds two essential null handling functions (fillna
and dropna
) to Ray Data, bringing it to feature parity with pandas and PySpark for basic ETL operations and ML dataset preprocessing.
Key changes include:
- Implementation of
fillna
method to replace missing values with scalar or column-specific values - Implementation of
dropna
method to remove rows containing missing values with flexible filtering options - Comprehensive test suites covering edge cases and different data types
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
python/ray/data/dataset.py |
Adds public API methods fillna and dropna with comprehensive documentation and examples |
python/ray/data/_internal/logical/operators/map_operator.py |
Implements logical operators FillNa and DropNa for the execution framework |
python/ray/data/_internal/planner/plan_udf_map_op.py |
Implements planning functions with PyArrow-based transformations for null handling |
python/ray/data/_internal/planner/planner.py |
Registers the new logical operators with their planning functions |
python/ray/data/tests/test_fillna.py |
Comprehensive test suite for fillna functionality |
python/ray/data/tests/test_dropna.py |
Comprehensive test suite for dropna functionality |
python/ray/data/BUILD |
Adds build targets for the new test files |
Comments suppressed due to low confidence (6)
python/ray/data/tests/test_fillna.py:105
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
python/ray/data/tests/test_dropna.py:53
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
python/ray/data/tests/test_fillna.py:192
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
python/ray/data/tests/test_dropna.py:104
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
python/ray/data/tests/test_fillna.py:220
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
python/ray/data/tests/test_dropna.py:208
- [nitpick] The variable name 'i' is not used in the loop body. Consider using '_' instead to indicate it's unused.
for i, (actual, exp) in enumerate(zip(rows, expected)):
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Adding comment to remove label. Also to mention larger changes to the code structure to add these as operators. |
Signed-off-by: soffer-anyscale <173827098+soffer-anyscale@users.noreply.github.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
- Add advanced filling methods: forward, backward, interpolate - Add limit parameter for consecutive fill operations - Add ignore_values parameter for custom missing value definitions - Add comprehensive parameter validation and error handling - Update documentation to match Ray Data style (remove framework references) - Add comprehensive test coverage with 35 test cases covering: * All new parameters and methods * Edge cases and error conditions * Multi-block behavior * Schema preservation * Performance testing Files modified: - dataset.py: Enhanced API with new parameters - fillna_operator.py: Advanced logical operator with validation - dropna_operator.py: Enhanced with ignore_values support - plan_fillna_op.py: Physical implementation of advanced methods - plan_dropna_op.py: Support for custom missing values - test_fillna.py: Comprehensive test suite (18 tests) - test_dropna.py: Comprehensive test suite (17 tests) Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
- Format code according to Ray's black 22.10.0 standards - Fix formatting in logical operators and planners - Update test file formatting Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
- Add Any to typing imports to resolve NameError when using List[Any] type annotations - Fixes test failures caused by missing type import Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
- Fix SystemException usage in exceptions.py (remove incorrect exception chaining) - Add missing Optional import in plan_fillna_op.py - All files now pass lint checks and follow proper import conventions Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
- Notebooks were reformatted by the pre-push hook linter - No functional changes, just formatting updates Signed-off-by: soffer-anyscale <stephen.offer@anyscale.com>
Why are these changes needed?
Null handling is a basic and common ETL requirement that other data frameworks have. It is important for feature parity and for ML dataset preprocessing to have common null handling features.
This PR adds
ds.fillna
andds.dropna
functions, modeled after Pandas and PySpark functionalities.Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.